﻿CREATE PROCEDURE [dbo].[proc_Employee_WageJx_Create]
	(
		@Sales nvarchar(50),
		@EName nvarchar(50),
		@TichengPrice numeric(18,2),
		@MTichengPrice numeric(18,2),
		@JixiaoPrice numeric(18,2),
		@JiangjinPrice numeric(18,2),
		@FafangDate datetime,
		@CompanyId int,
		@Description nvarchar(50),
		@olist nvarchar(2000)
	)
AS
begin
	Insert Into Employee_WageJx
	(Sales,EName,TichengPrice,JixiaoPrice,JiangjinPrice,FafangDate,CompanyId,Description,MTichengPrice) 
	Values(@Sales,@EName,@TichengPrice,@JixiaoPrice,@JiangjinPrice,@FafangDate,@CompanyId,@Description,@MTichengPrice)
	
	Declare @i int
	Set @i=0
	while(@i<len(@olist))
	begin
		Update Orders Set TichengFlag=1 Where Id=substring(@olist,@i,charindex(',',@olist,@i)-@i)
	Set @i=charindex(',',@olist,@i)+1
	end
end	
	RETURN
